import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter/material.dart';

class SyMyBanner extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    List<int> list = [1, 2, 3, 4, 5];
    return Container(
        height: 170,
        width: double.infinity,
        child: CarouselSlider(
          options: CarouselOptions(
            viewportFraction: 1.0, // ❗ 每页占满整个视口
            enlargeCenterPage: false, // 可选，防止中间放大
            autoPlay: true, // 可选，自动播放
            scrollPhysics: BouncingScrollPhysics(), // 允许滑动但能配合父ScrollView
          ),
          items: list.map((item) => Container(
            child: Center(child: Text(item.toString())),
            color: item%2==0?Colors.blue:Colors.amber,
          ))
              .toList(),
        ));
  }
}
